$SAVE
$NOLIST
;************************************************************************
;*									*
;*    R T X - 5 1  :    CONSTANT DECLARATIONS                           *
;*							     		*
;*----------------------------------------------------------------------*
;*                                                                      *
;*    Filename     :   RTXCONST.INC                                     *
;*    Language     :   Keil A-51                                        *
;*    Dev. system  :   Keil uVision2                                    *
;*    Targetsystem :   Any system based upon 8051 up                    *
;*                                                                      *
;*    Purpose      :   Declaration of the globally used RTX-51          *
;*                     system-constants                                 *
;*								     	*
;*								     	*
;*----------------------------------------------------------------------*
;* Rev. |  Released   | Programmer    | Comments                        *
;*----------------------------------------------------------------------*
;*  0.1 |  4.4.1991   | Th. Fischler  | New system constants vor V4.0   *
;*      | 12.4.1991   | Th. Fischler  | Constant for Interrupt owner    *
;*      |             |               | list                            *
;*      | 18.9.1991   |               | Definition for supervisor-mode  *
;*      |             |               | flag removed                    *
;*      | 20.9.1991   |               | Definitions for memory-pools    *
;*      |             |               | added                           *
;* 5.00 | 12.10.1994  | E. Glatz      | New: SEM_EVENT                  *
;* 7.00 | 13.11.2001  | T. Mueller    | Port 2 definition deleted       *
;************************************************************************
;*    Copyright 1991 .. 2001 METTLER  &  FUCHS  AG,  CH-8953 Dietikon   *
;************************************************************************

;*----------------------------------------------------------------------*
;*      D E B U G  S U P P O R T
;*----------------------------------------------------------------------*

;
;   DBG = 0 : Standard-Version
;   DBG = 1 : BUSY_FLAG, LOCK_FLAG, SYSOP_FLAG and CLOCK_FLAG are defined
;             (see source documentation)
;   DBG = 2 : BUSY_FLAG and DEBUG_TID are defined (see source documentation)
;   DBG = 3 : 32 Bit SYSCLK_COUNT (see source documentation)
;
$SET(DBG = 0)


;*----------------------------------------------------------------------*
;*      C O N S T A N T S
;*----------------------------------------------------------------------*

; System-clock constants
DEFAULT_TIME_SLICE   EQU  20000         ; default clock at system-init
CLK_SLICE_MIN        EQU   1000         ; minimal allowed system-clock slice
CLK_SLICE_MAX        EQU  40000         ; maximal allowed sytem-clock slice
UNUSED_CLK_PART      EQU  0FFFFH-CLK_SLICE_MAX

;  System-Constants
TASK_COUNT        EQU   19       ; max. number of ative tasks
NBR_OF_INT        EQU   32       ; max. number of interrupt-sources

;
;       Constants for the ISR-LIFO Handling
;
ISR_LIFO_SIZE     EQU   30       ; size in bytes of the ISR-LIFO
ISR_SEND_SIG_CMD  EQU   0F0H     ; constant for isr_send_signal command
ISR_NF_CHK_CMD    EQU   0F1H     ; constant for nf_check_req command
REQ_ROUND_R_CMD   EQU   0F2H     ; constant for round robin request

;
;       Constants for the memory-pool functions
;
NBR_OF_POOLS      EQU   16       ; number of supported memory-pools
NIL_BLOCK         EQU   0FFH     ; constant for no next block

;
;       Constants for the user_num_table
;
NO_TASK           EQU   0FFH     ; No Task exists


;	
;       Constants for task id
;
NIL_TID           EQU   0EFH     ; NIL value for task_id,Bit 4=0:non driver
                                 ; (important for allow_int)
SYSCLK_TID        EQU   0E0H     ; Systemclock handler
MAX_TID           EQU   0DFH     ; Maximal valid task id (virtual)


;
;       Context types
;
FULL              EQU   0FFH
REDUCED           EQU   000H


;
;	System call return equates
;
OK                EQU   00H
NOT_OK            EQU   0FFH

MSG_EVENT         EQU   01H
INT_EVENT         EQU   02H
SIG_EVENT         EQU   03H
TMO_EVENT         EQU   04H
SEM_EVENT         EQU   05H
NFL_EVENT         EQU   06H
NIL_EVENT         EQU   0FFH

;
;       Define Debug-Port addresses
;
$IF (DBG = 01H)
   ;
   ;     Define debug signal port addresses (not used if DBG flag is
   ;     set to zero)
   ;
   BUSY_FLAG_ADR   EQU     090H
   LOCK_FLAG_ADR   EQU     091H
   SYSOP_FLAG_ADR  EQU     092H
   CLOCK_FLAG_ADR  EQU     093H
$ENDIF

;   ALWAYS IDENTICAL REGISTERS
;
;	These register decalartions are valid for all processor types.
;	Only registers used by RTX-51 are declared here !

PSW    DATA  0D0H          ; For context save/restore
ACC    DATA  0E0H
B      DATA  0F0H
SP     DATA  81H
DPL    DATA  82H
DPH    DATA  83H

RB1R0  DATA  08H           ; Registers in Registerbank 1
RB1R1  DATA  09H
RB1R2  DATA  0AH
RB1R3  DATA  0BH
RB1R4  DATA  0CH
RB1R5  DATA  0DH
RB1R6  DATA  0EH
RB1R7  DATA  0FH
RB2R0  DATA  10H           ; Registers in Registerbank 2
RB2R1  DATA  11H
RB2R2  DATA  12H
RB2R3  DATA  13H
RB2R4  DATA  14H
RB2R5  DATA  15H
RB2R6  DATA  16H
RB2R7  DATA  17H
RB3R0  DATA  18H           ; Registers in Registerbank 3
RB3R1  DATA  19H
RB3R2  DATA  1AH
RB3R3  DATA  1BH
RB3R4  DATA  1CH
RB3R5  DATA  1DH
RB3R6  DATA  1EH
RB3R7  DATA  1FH

$RESTORE
